home *** CD-ROM | disk | FTP | other *** search
/ Power Programmierung / Power-Programmierung (Tewi)(1994).iso / magazine / progjour / 1991 / 06 / alib / put_hex.asm < prev    next >
Assembly Source File  |  1991-06-25  |  534b  |  47 lines

  1.     include    asm.inc
  2.  
  3.     public    put_hex_word
  4.     public    put_hex_byte
  5.  
  6.     .code
  7.     extn    putchar
  8.  
  9.  
  10. ;;    put hex byte
  11. ;
  12. ;    entry    AL    byte
  13. ;    uses    AX
  14. ;    note    calls putchar to write chrs
  15. ;
  16. put_hex_byte proc
  17.     push    ax
  18.     sar    al,1
  19.     sar    al,1
  20.     sar    al,1
  21.     sar    al,1
  22.     call    ohb1
  23.     pop    ax
  24. ohb1:    and    al,0Fh
  25.     add    al,90h
  26.     daa
  27.     adc    al,40h
  28.     daa
  29.     jmp    putchar
  30. put_hex_byte endp
  31.  
  32.  
  33. ;;    put hex word
  34. ;
  35. ;    entry    AX    word
  36. ;    uses    AX
  37. ;
  38. put_hex_word proc
  39.     push    ax
  40.     mov    al,ah
  41.     call    put_hex_byte
  42.     pop    ax
  43.     jmp    put_hex_byte
  44. put_hex_word endp
  45.  
  46.     end
  47.